package cn.good.yan.mapper;

import cn.good.yan.entity.Storage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * 库存实体
 *
 * @author shengren.yan
 * @create 2024-02-22
 */
@Mapper
public interface StorageMapper extends BaseMapper<Storage> {

    // 扣除 该产品 的仓库的库存
//    @Update("UPDATE t_storage SET used = used + #{count} , residue = residue - #{count} WHERE product_id = #{productId}")
//    void derease(@Param("productId") Long productId, @Param("count") Integer count);

    @Select(" select * from t_storage where product_id = #{productId} ")
    Storage findByMid(Long productId);

}
